package com.hrg.rds.infra.connect.protocol.modbus;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

// PlcIECValue
@Getter
public enum ModbusDataType {
	BOOL("boolean"),
	SINT("int 8"),
	USINT("uint 8"),
	BYTE("uint 8"),
	INT("int 16"),
	UINT("uint 16"),
	WORD("uint 16"),
	DINT("int 32"),
	UDINT("uint 32"),
	DWORD("uint 32"),
	LINT("int 64"),
	ULINT("uint 64"),
	LWORD("uint 64"),
	REAL("float"),
	LREAL("double"),
	CHAR("char"),
	WCHAR("2 byte char")
	;
	ModbusDataType(String description) {
		this.description = description;
	}
	private final String description;

	private static final Map<String, ModbusDataType> map = new HashMap<>();
	static {
		for (ModbusDataType modbusDataType : ModbusDataType.values()) {
			map.put(modbusDataType.description, modbusDataType);
		}
	}

	public static ModbusDataType get(String description) {
		return map.get(description);
	}
}
